// component/amount/index.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    count: {
      type: Number,
      value: 1
    }
  },

  /**
   * 组件的初始数据
   */
  data: {

  },

  /**
   * 组件的方法列表
   */
  methods: {
    cut: function(){
      //console.log(this.data)
      let count = this.data.count
      if(count>1){
        count--
      }else{
        count = 1
      }
      this.setData({
        count: count
      })
      let val = count;
      this.triggerEvent('myEven',val)
      this.triggerEvent('subevent')
    },
    add: function(){
      //console.log(this.data)
      var count = this.data.count;
      this.setData({
        count: ++count
      })
      //console.log(count)
      let val = count;
      this.triggerEvent('myEven', val)
      this.triggerEvent('addevent')
    }
  }
})
